import 'package:flutter_html/flutter_html.dart';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:magic_car/util/HttpHelper.dart';
import 'package:magic_car/util/config.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:webview_flutter/webview_flutter.dart';

class QueryReusltPage extends StatefulWidget {
  QueryReusltPage(this.queryid,this.urlstr);

  // final String title;
  final String queryid;
  final String urlstr;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<QueryReusltPage> {
  var content = '';
  Map acountinfo = new Map();
  String url = "";
  @override
  void initState() {
    super.initState();

    loaddata();
  }

  //加载数据
  loaddata() async {
    Map<String, String> map = new Map();
    SharedPreferences pref = await SharedPreferences.getInstance();
    map["uid"] = pref.getString('uid');
    map["id"] = widget.queryid;

    HttpHelper.post(HttpHelper.API_GetQueryResult, (data) async {
      print(data);
      if (data != null) {
        print(data);

        if (data["code"].toString() == "1") {
          setState(() {
           // url = data['info']['result_url'];
            //  acountinfo = data["info"];
          });
        } else {}
      }
    }, params: map);
  }

  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: new AppBar(
          titleSpacing: 0,
          title: new Text(
            '数据详情',
            style: TextStyle(fontSize: Config.title_size),
          ),
          backgroundColor: Colors.white,
          elevation: 0,
        ),
        body: new Container(
          // decoration: BoxDecoration(
          //   color: Colors.grey
          // ),
          width:MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height,
          child: WebView(
            
            initialUrl: widget.urlstr,
            javascriptMode: JavascriptMode.unrestricted, // 使用JS没限制
          ),
        ));
  }
}
